-------------------------------------------------------------------------------
--	 File name: init.lua
--		Author: Sploder
-- 		  Date: 03/04/2010
-- Description: This file contains the main body of code used by the knifeHit
--					effect.
--
-------------------------------------------------------------------------------

AddCSLuaFile("init.lua")

EFFECT.TotalTime = 0.5

-------------------------------------------------------------------------------
--	  Function: EFFECT:Init()
-- Description: This function is called when the effect is initialized.
-------------------------------------------------------------------------------
function EFFECT:Init()
	self.time = CurTime() + self.TotalTime
	self.mat = Material("sprites/danmaku/hitBig01")
end

-------------------------------------------------------------------------------
--	  Function: EFFECT:Think()
-- Description: This function is called every step.
-------------------------------------------------------------------------------
function EFFECT:Think()
	if (self.time > CurTime())
	then
		return true
	end
	return false
end

-------------------------------------------------------------------------------
--	  Function: EFFECT:Render()
-- Description: This function is called when the effect is rendered.
-------------------------------------------------------------------------------
function EFFECT:Render()
	self.mat:SetMaterialInt("$frame",
							math.Clamp(math.Round(18 - (18 * ((self.time - CurTime()) / self.TotalTime))), 0, 18))
	render.SetMaterial(self.mat)
	render.DrawSprite(self:GetPos(), 32, 32, Color(255, 0, 0, 255))
end